package main.com.yyx.pool;

import java.sql.Connection;

public class MyPooledConnection {

    private Connection connection;

    //2次 not busy 关闭该connection
    private int notbusyCount=0;

    public static int NOTBUSYCOUNTMAX= 2;

    //是否忙碌
    private boolean busy;

    public MyPooledConnection(Connection connection, boolean busy) {
        this.connection = connection;
        this.busy = busy;
    }

    public Connection getConnection() {
        return connection;
    }

    public void setConnection(Connection connection) {
        this.connection = connection;
    }

    public boolean isBusy() {
        return busy;
    }

    public void setBusy(boolean busy) {
        this.busy = busy;
    }

    public void close() {
        this.busy = false;
    }

    protected int getNotbusyCount() {
        return notbusyCount;
    }

    protected void increNotbusyCount() {
        notbusyCount++;
    }


    protected void clearNotbusyCount() {
        notbusyCount=0;
    }
}
